<%
	def transcation = request.transcation
%>
<div align="left">
	<a href="#" data-rel="back">Back</a>
</div>
<form action="expensesCreateOrUpdate.groovy" method="post" id="frmExpenses" data-ajax="false">
	<div data-role="fieldcontain">
		<label for="transcationKey">Id</label>
		<% if(transcation.key.id == 0) { %>
		<input type="text" name="transcationKey" value="New" readonly="readonly" id="transcationKey" class="required"/>
		<% } else { %>
		<input type="text" name="transcationKey" value="${transcation.key.id}" id="transcationKey" class="required" readonly="readonly"/>
		<% } %>
	</div>
	<div data-role="fieldcontain">
		<label for="transcationAmount">Amount</label>
		<input type="text" name="transcationAmount" value="${transcation.amount}" id="transcationAmount" class="required"/>
	</div>
	<div data-role="fieldcontain">
		<label for="transcationDescription">Description</label>
		<input type="text" name="transcationDescription" value="${transcation.description}" id="transcationDescription" class="required"/>
	</div>
	<div data-role="fieldcontain">
		<label for="transcationTags">Tags</label>
		<input type="text" name="transcationTags" value="${request.transcationTags}" id="transcationTags" class="required"/>
	</div>
	<div data-role="fieldcontain">
		<label for="transcationCreatedDateStg">Date</label>
		<input type="date" name="transcationCreatedDateStg" value="${transcation.createdDateStg}" 
		id="transcationCreatedDateStg" class="required" data-role="datebox" data-options='{"mode": "calbox", "disableManualInput": true}'/>
	</div>
	<div data-role="fieldcontain">
		<label for="transcationCreatedTimeStg">Time</label>
		<input type="date" name="transcationCreatedTimeStg" value="${transcation.createdTimeStg}" 
		id="transcationCreatedTimeStg" class="required" data-role="datebox" data-options='{"mode": "timebox", "disableManualInput": true}' />
	</div>
	<div align="center">
		<button type="submit" name="action" value="createOrUpdate" data-inline="true" data-theme="b">Submit</button>
	</div>
</form>

<script>
\$(document).ready(function(){
   	\$("#frmExpenses").validate({
   	    submitHandler: function(form) {
       		form.submit();
   	    }
   	});
   	\$('#transcationAmount').focus();
 });
</script>